package com.higgins.client;

import com.higgins.client.tabs.CoveringLetterTab;
import com.higgins.client.tabs.LawFirmTab;
import com.higgins.client.tabs.RecipientTab;
import com.higgins.client.tabs.StrategyTab;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.logical.shared.SelectionEvent;
import com.google.gwt.event.logical.shared.SelectionHandler;
import com.google.gwt.user.client.ui.RootLayoutPanel;
import com.google.gwt.user.client.ui.TabPanel;
import com.google.gwt.user.client.ui.VerticalPanel;

/**
 * Entry point classes define <code>onModuleLoad()</code>.
 */
public class HibernateCloudSQL implements EntryPoint {

	public void onModuleLoad() {
		TabPanel tabPanel = new TabPanel();
		tabPanel.setSize("200em","100em");
		final StrategyTab strategyTab = new StrategyTab();
		tabPanel.add(strategyTab, "Strategy");
		strategyTab.update();
		final RecipientTab recipientTab = new RecipientTab();
		tabPanel.add(recipientTab, "Recipients");
		final LawFirmTab lawFirmTab = new LawFirmTab();
		tabPanel.add(lawFirmTab, "Law Firm");
		final CoveringLetterTab coveringLetterTab = new CoveringLetterTab();
		tabPanel.add(coveringLetterTab, "Covering Letter");
		
		RootLayoutPanel.get().add(tabPanel);
		tabPanel.selectTab(0);
		tabPanel.addSelectionHandler(new SelectionHandler<Integer>()    {

			@Override
			public void onSelection(SelectionEvent<Integer> event) {
				int selection = event.getSelectedItem();
				
				switch (selection)	{
				case 0:
					strategyTab.update();
					break;
				case 1:
					recipientTab.update();
					break;
				case 2:
					lawFirmTab.update();
					break;
				case 3:
					coveringLetterTab.update();
					break;
				}
			}
		});
	}
}
